﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace ImageK.Java
{
    public static class ControlExtensions
    {
        // Sets the values of four properties for this scroll bar: value, visibleAmount, minimum, and maximum.If the values supplied for these properties are inconsistent or incorrect, they will be changed to ensure consistency.
        //     This method simultaneously and synchronously sets the values of four scroll bar properties, assuring that the values of these properties are mutually consistent. It enforces the following constraints: maximum must be greater than minimum, maximum - minimum must not be greater than Integer.MAX_VALUE, visibleAmount must be greater than zero. visibleAmount must not be greater than maximum - minimum, value must not be less than minimum, and value must not be greater than maximum - visibleAmount
        //     Calling this method does not fire an AdjustmentEvent.
        //     Params:
        // value – is the position in the current window visible – is the visible amount of the scroll bar minimum – is the minimum value of the scroll bar maximum – is the maximum value of the scroll bar
        //     See Also:
        // setMinimum, setMaximum, setVisibleAmount, setValue
        public static void setValues(this ScrollBar scrollBar, int value, int visible, int minimum, int maximum)
        {
            scrollBar.Value = value;
            scrollBar.Visible = visible >0;
            scrollBar.Minimum = minimum;
            scrollBar.Maximum = maximum;
        }
    }
}
